package com.bokee.archerwq.lab.pattern.state;

/**
 * state machine
 * 
 * @author Will 2010-4-6
 */
public class Context {

	public static ConcreteState1 state1 = new ConcreteState1();
	public static ConcreteState2 state2 = new ConcreteState2();

	private State state = state1;

	public State getState() {
		return state;
	}

	public void setState(State state) {
		this.state = state;
	}

	/**
	 * delegates the event to State
	 */
	public void event1() {
		state.event1(this);
	}

	public void event2() {
		state.event2(this);
	}

	protected void action1() {
		System.out.println("executing action1");
	}

	protected void action2() {
		System.out.println("executing action2");
	}

	protected void action3() {
		System.out.println("executing action3");
	}

	protected void action4() {
		System.out.println("executing action4");
	}

}
